<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="UTF-8">
  <meta 
    name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <meta 
    http-equiv="X-UA-Compatible" 
    content="ie=edge">
  <meta 
    name="theme-color" 
    content="#fff" 
    id="theme-color">
  <meta 
    name="description" 
    content="程序员的快乐小网站">
  <link 
    rel="icon" 
    href="https://demo.theme-kaze.top/img/Kaze.png">
  <title>计算机网络传输层（上）</title>
  
    
      <meta 
        property="og:title" 
        content="计算机网络传输层（上）">
    
    
      <meta 
        property="og:url" 
        content="http://www.baikaihua.gitee.io/2021/10/14/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BC%A0%E8%BE%93%E5%B1%82%EF%BC%88%E4%B8%8A%EF%BC%89/index.html">
    
    
      <meta 
        property="og:img" 
        content="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012162116.jpg">
    
    
      <meta 
        property="og:img" 
        content="&lt;p&gt;整理：白开画&lt;/p&gt;">
    
    
      <meta 
        property="og:type" 
        content="article">
      <meta 
        property="og:article:published_time" 
        content="2021-10-14">
      <meta 
        property="og:article:modified_time" 
        content="2021-10-27">
      <meta 
        property="og:article:author" 
        content="白开画 and 徐威">
      
        
          <meta 
            property="og:article:tag" 
            content="计算机网络">
        
          <meta 
            property="og:article:tag" 
            content="网络">
        
          <meta 
            property="og:article:tag" 
            content="白开画">
        
          <meta 
            property="og:article:tag" 
            content="基础">
        
      
    
  
  <script>
    function loadScript(url, cb) {
      var script = document.createElement('script');
      script.src = url;
      if (cb) script.onload = cb;
      script.async = true;
      document.body.appendChild(script);
    }
    function loadCSS(href, data, attr) {
      var sheet = document.createElement('link');
      sheet.ref = 'stylesheet';
      sheet.href = href;
      sheet.dataset[data] = attr;
      document.head.appendChild(sheet);
    }
    function changeCSS(cssFile, data, attr) {
      var oldlink = document.querySelector(data);
      var newlink = document.createElement("link");
      newlink.setAttribute("rel", "stylesheet");
      newlink.setAttribute("href", cssFile);
      newlink.dataset.prism = attr;
      document.head.replaceChild(newlink, oldlink);
    }
  </script>
  
    
  
  <script>
    // control reverse button
    var reverseDarkList = {
      dark: 'light',
      light: 'dark'
    };
    var themeColor = {
      dark: '#1c1c1e',
      light: '#fff'
    }
    // get the data of css prefers-color-scheme
    var getCssMediaQuery = function() {
      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    };
    // reverse current darkmode setting function
    var reverseDarkModeSetting = function() {
      var setting = localStorage.getItem('user-color-scheme');
      if(reverseDarkList[setting]) {
        setting = reverseDarkList[setting];
      } else if(setting === null) {
        setting = reverseDarkList[getCssMediaQuery()];
      } else {
        return;
      }
      localStorage.setItem('user-color-scheme', setting);
      return setting;
    };
    // apply current darkmode setting
  </script>
  
    <script>
      var setDarkmode = function(mode) {
      var setting = mode || localStorage.getItem('user-color-scheme');
      if(setting === getCssMediaQuery()) {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else if(reverseDarkList[setting]) {
        document.documentElement.setAttribute('data-user-color-scheme', setting);
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[getCssMediaQuery()];
        document.getElementById('theme-color').dataset.mode = getCssMediaQuery();
      }
    };
    setDarkmode();
    </script>
  
  
  <link rel="preload" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css" as="style" >
  <link rel="preload" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.js" as="script">
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lozad.min.js" as="script">
  
  
  
  
    
    <link rel="prefetch" href="//cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" as="script">
  
  
    
    <link rel="prefetch" href="//unpkg.com/valine/dist/Valine.min.js" as="script">
  
  
  
  <link rel="stylesheet" href="/css/main.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css">
  
    <link rel="stylesheet" href="/js/lib/lightbox/baguetteBox.min.css">
  
<meta name="generator" content="Hexo 5.4.0"></head>

  <body>
    <div class="wrapper">
       
      <nav class="navbar">
  <div class="navbar-logo">
    <span class="navbar-logo-main">
      
        <img 
          class="navbar-logo-img" 
          src="https://demo.theme-kaze.top/img/Kaze.png" 
          alt="blog logo">
      
      <span class="navbar-logo-dsc">程序小站</span>
    </span>
  </div>
  <div class="navbar-menu">
    
      <a 
        href="/" 
        class="navbar-menu-item">
        
          首页
        
      </a>
    
      <a 
        href="/archives" 
        class="navbar-menu-item">
        
          归档
        
      </a>
    
      <a 
        href="/tags" 
        class="navbar-menu-item">
        
          标签
        
      </a>
    
      <a 
        href="/categories" 
        class="navbar-menu-item">
        
          分类
        
      </a>
    
      <a 
        href="/about" 
        class="navbar-menu-item">
        
          关于
        
      </a>
    
    <a 
      class="navbar-menu-item darknavbar" 
      id="dark">
      <i class="iconfont icon-weather"></i>
    </a>
    <a 
      class="navbar-menu-item searchnavbar" 
      id="search">
      <i 
        class="iconfont icon-search" 
        style="font-size: 1.2rem; font-weight: 400;">
      </i>
    </a>
  </div>
</nav> 
      
      <div 
        id="local-search" 
        style="display: none">
        <input
          class="navbar-menu-item"
          id="search-input"
          placeholder="请输入搜索内容..." />
        <div id="search-content"></div>
      </div>
      
      <div class="section-wrap">
        <div class="container">
          <div class="columns">
            <main class="main-column">
  <div class="image-wrapper">
    <img 
      src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012162116.jpg" 
      data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012162116.jpg"
      srcset="data:image/svg+xml,%3Csvg%20xmlns=&#39;http://www.w3.org/2000/svg&#39;%20viewBox=&#39;0%200%20300%20300&#39;%3E%3C/svg%3E"
      class="image lozad"
      alt="计算机网络传输层（上） thumbnail">
  </div>

<article class="card card-content">
  <header>
    <h1 class="post-title">
      计算机网络传输层（上）
    </h1>
  </header>
  <div class="post-meta post-show-meta">
    <time datetime="2021-10-14T15:28:54.971Z">
      <i 
        class="iconfont icon-calendar" 
        style="margin-right: 2px;">
      </i>
      <span>2021-10-14</span>
    </time>
    
      <span class="dot"></span>
      
        <a 
          href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/" 
          class="post-meta-link">
          计算机网络
        </a>
      
    
    
      <span class="dot"></span>
      <span>1.7k 字</span>
    
  </div>
  
    <div 
      class="post-meta post-show-meta" 
      style="margin-top: -10px;">
      <div style="display: flex; align-items: center;">
        <i 
          class="iconfont icon-biaoqian" 
          style="margin-right: 2px; font-size: 1.15rem;">
        </i>
        
          
          <a 
            href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/" 
            class="post-meta-link">
            计算机网络
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E7%BD%91%E7%BB%9C/" 
            class="post-meta-link">
            网络
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E7%99%BD%E5%BC%80%E7%94%BB/" 
            class="post-meta-link">
            白开画
          </a>
        
          
            <span class="dot"></span>
          
          <a 
            href="/tags/%E5%9F%BA%E7%A1%80/" 
            class="post-meta-link">
            基础
          </a>
        
      </div>
    </div>
  
  </header>
  <div 
    id="section" 
    class="post-content">
    <p>整理：白开画</p>
<span id="more"></span>
<h1 id="计算机网络传输层上"><a class="markdownIt-Anchor" href="#计算机网络传输层上"></a> 计算机网络传输层（上）</h1>
<h2 id="传输层概述"><a class="markdownIt-Anchor" href="#传输层概述"></a> 传输层概述</h2>
<p>1.传输层协议为运行在不同host上的进程提供了一种<strong>逻辑通信机制</strong>。</p>
<p>2.端系统运行传输层协议：</p>
<ul>
<li>发送方：将应用递交的消息分成一个或多个的segment，并向下穿给网络层。</li>
<li>接受方：将接受到的segment组装成消息，并向上叫给应用层。</li>
</ul>
<p>传输层可以为应用提供多种协议，如：TCP、UDP。</p>
<p>3.传输层与网络层</p>
<p>网络层：提供<strong>主机</strong>之间的逻辑通信机制。</p>
<p>传输层：提供<strong>应用进程</strong>之间的逻辑通信机制。</p>
<ul>
<li>位于网络层之上</li>
<li>依赖于网络层服务</li>
<li>对网络层服务进行（可能）增强</li>
</ul>
<p>4.Internet传输层协议。</p>
<p>（1）可靠、按序的交付服务（TCP）</p>
<ul>
<li>拥塞控制</li>
<li>流量控制</li>
<li>连接建立</li>
</ul>
<p>（2）不可靠的交付服务（UDP）</p>
<ul>
<li>基于“尽力而为”的网络层，没有可靠性方面的扩展</li>
</ul>
<p>（3）两种服务均不保证<strong>延迟</strong>和<strong>带宽。</strong></p>
<h2 id="多路复用和多路分用"><a class="markdownIt-Anchor" href="#多路复用和多路分用"></a> 多路复用和多路分用</h2>
<p>1.接受端进行多路分用：传输层依据头部信息将收到的segment交给正确的socket，即不同的进程。</p>
<p>发送端进行多路复用：从多个socket接受数据，为每块数据封装上头部信息，生成segment，交给网络层。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012162116.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012162116.jpg" class="lozad post-image"></p>
<p>2.分用的工作方式</p>
<p>（1）主机收到IP数据报</p>
<ul>
<li>
<p>每个数据报携带IP地址、目的IP地址</p>
</li>
<li>
<p>每个数据携带一个传输层的段</p>
</li>
<li>
<p>每个段携带源端口号和目的端口号</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012163236.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012163236.jpg" class="lozad post-image"></p>
</li>
</ul>
<p>（2）主机收到segment之后，传输层协议提取IP地址和端口号信息，将segment导向响应的socket（TCP做更多处理）。</p>
<p>3.无连接分用（UDP）</p>
<p>（1）利用端口号创建socket。</p>
<p>（2）UDP的socket用二元标识（目的IP地址、目的端口号）。</p>
<p>（3）主机收到UDP段后</p>
<ul>
<li>检查段中的目的端口号</li>
<li>将UDP段导向绑定在该端口号的socket</li>
</ul>
<p>（4）来自不同源IP地址或源端口号IP数据包被导向同一个socket。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012165342.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012165342.jpg" class="lozad post-image"></p>
<p>4.面向连接的分用（TCP）</p>
<p>（1）TCP的socket用四元组标识（源IP地址、源端口号、目的IP地址、目的端口号）。</p>
<p>（2）接受端利用所有的四个值将segment导向合适的socket。</p>
<p>（3）服务器可能同时支持多个TCPsocket。</p>
<p>（4）web服务器为每个客户端开不同的socket。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012165315.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211012165315.jpg" class="lozad post-image"></p>
<h2 id="无连接传输协议udp"><a class="markdownIt-Anchor" href="#无连接传输协议udp"></a> 无连接传输协议UDP</h2>
<p>1.简介</p>
<p>（1）基于Internet IP协议</p>
<ul>
<li>复用/分用</li>
<li>简单的错误效验</li>
</ul>
<p>（2）“best effort”服务，UDP段可能丢失和非按序到达。</p>
<p>（3）无连接：UDP发送方和接收方之间不需要握手，且每个UDP段的处理独立于其他段。</p>
<p>（4）UDP的优点</p>
<ul>
<li>无需建立连接（延迟短）</li>
<li>实现简单，无需维护连接状态</li>
<li>头部开销小</li>
<li>没有拥塞控制：应用可更好地控制发送时间速率</li>
</ul>
<p>（5）常用与流媒体应用、DNS、SNMP</p>
<ul>
<li>容忍丢失</li>
<li>速率敏感</li>
</ul>
<p>2.UDP效验和checksum</p>
<p>（1）发送方将段的内容视为16-bit整数，计算所有整数的和，进位加在和的后面，将得到的值按位求反，得到效验和，发送方将效验和放入效验字段。</p>
<p>（2）接收方计算所收到段的效验和，将其与效验和字段进行对比，和相等时也可能存在错误。</p>
<h2 id="可靠数据传输的基本原理"><a class="markdownIt-Anchor" href="#可靠数据传输的基本原理"></a> 可靠数据传输的基本原理</h2>
<h3 id="可靠数据传输概述"><a class="markdownIt-Anchor" href="#可靠数据传输概述"></a> 可靠数据传输概述</h3>
<p>1.可靠数据传输协议</p>
<ul>
<li>可靠数据传输对应用层、传输层、数据链路层都很重要</li>
<li>属于网络top-10问题</li>
<li>信道的不可靠特性决定了可靠数据协议（rdt）的复杂性</li>
</ul>
<p>2.接口</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013153302.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013153302.jpg" class="lozad post-image"></p>
<h3 id="rdt-10"><a class="markdownIt-Anchor" href="#rdt-10"></a> rdt 1.0</h3>
<p>1.底层信道完全可靠，不会发生错误，不会丢弃分组。</p>
<p>2.发送方和接受方的FSM独立。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013154438.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013154438.jpg" class="lozad post-image"></p>
<h3 id="rdt-20"><a class="markdownIt-Anchor" href="#rdt-20"></a> rdt 2.0</h3>
<p>1.底层信道可能翻转分组中的位</p>
<ul>
<li>利用效验和检测位错误</li>
</ul>
<p>2.确认机制</p>
<p>（1）接受方显然地告诉发送单分组已正确接收。</p>
<p>（2）NAK：接收方显示地告诉发送方分组有错误。</p>
<p>（3）发送方收到NAK后，重传分组。</p>
<p>3.基于这种重传机制的rdt协议称为ARQ协议</p>
<p>4.FSM规约</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013155733.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013155733.jpg" class="lozad post-image"></p>
<p>5.rdt 2.0的缺陷</p>
<ul>
<li>ACK/NAK出现错误</li>
</ul>
<h3 id="rdt-21和22"><a class="markdownIt-Anchor" href="#rdt-21和22"></a> rdt 2.1和2.2</h3>
<p>1.rdt 2.1解决了ACK/NAK错误问题。</p>
<p>2.FSM</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013160651.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013160651.jpg" class="lozad post-image"></p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013160736.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211013160736.jpg" class="lozad post-image"></p>
<p>3.rdt 2.1 和 rdt 2.0</p>
<p>（1）发送方：</p>
<ul>
<li>为每一个分组增加的序列号</li>
<li>需效验ACK/NAK消息是否发送错误</li>
<li>状态数量翻倍</li>
</ul>
<p>（2）接收方</p>
<ul>
<li>需判断分组是否重复</li>
</ul>
<p>4.rdt 2.2 无NAK消息</p>
<p>（1）与rdt 2.1功能相同，但是只使用ACK。</p>
<p>（2）接受方通过ACK告知最后一个被接收的分组，在ACK消息中显示地加入被确认分组的序列号。</p>
<p>（3）发送方收到重复ACK之后，采取重传当前分组。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014134121.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014134121.jpg" class="lozad post-image"></p>
<h3 id="rdt-30"><a class="markdownIt-Anchor" href="#rdt-30"></a> rdt 3.0</h3>
<p>1.相对于rdt 2.2，rdt 3.0增加了定时器功能，解决当信道传输数据时分组丢失问题。</p>
<p>2.FSM</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014135142.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014135142.jpg" class="lozad post-image">)</p>
<p>3.性能</p>
<p>（1）rdt 3.0能够正常工作，但性能很差，网络协议限制了物理资源的利用。</p>
<h2 id="流水线机制与滑动窗口协议"><a class="markdownIt-Anchor" href="#流水线机制与滑动窗口协议"></a> 流水线机制与滑动窗口协议</h2>
<h3 id="流水线协议"><a class="markdownIt-Anchor" href="#流水线协议"></a> 流水线协议</h3>
<p>1.允许发送方在收到ACK之前连续发送多个分组</p>
<ul>
<li>更大的序列号范围</li>
<li>发送方和接收方需要更大的存储空间以缓存分组</li>
</ul>
<h3 id="滑动窗口协议gbnsr"><a class="markdownIt-Anchor" href="#滑动窗口协议gbnsr"></a> 滑动窗口协议（GBN,SR）</h3>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014141029.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014141029.jpg" class="lozad post-image"></p>
<p>1.窗口：允许使用的序列号范围，窗口尺寸为N，最多有N个等待消息。</p>
<p>2.滑动窗口：随着协议的运行，窗口在序列号空间内向前滑动。</p>
<h3 id="gnb协议"><a class="markdownIt-Anchor" href="#gnb协议"></a> GNB协议</h3>
<p>1.发送方</p>
<p>（1）分组头部包含k-bit序列号。</p>
<p>（2）窗口尺寸为N，最多允许N个分组未确定。</p>
<p>（3）ACK：确定到序列号n的分组均已被正确接收（可能受到重复ACK）。</p>
<p>（4）为空中的分组设置计时器。</p>
<p>（5）超时timeout事件：重传序列号大于等于n，还未受到ACK的所有分组。</p>
<p>（6）FSM</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014202004.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014202004.jpg" class="lozad post-image"></p>
<p>2.接收方</p>
<p>（1）ACK机制：发送拥有最高序列号的、已被正确接收的分组的ACK。</p>
<ul>
<li>可能产生重复的ACK</li>
<li>只需要记住唯一的expectedseqnum</li>
</ul>
<p>（2）对乱序到达的分组的处理：</p>
<ul>
<li>直接丢弃（接收方没有缓存）</li>
<li>重新确认序列号最大的、按序到达的分组</li>
</ul>
<p>（3）FSM</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014202457.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014202457.jpg" class="lozad post-image"></p>
<h3 id="srselective-repeat协议"><a class="markdownIt-Anchor" href="#srselective-repeat协议"></a> SR（Selective Repeat）协议</h3>
<p>1.对GNB协议的优化</p>
<p>（1）接收方设置缓存分区，缓存乱序到达的分组，对每个分组单独进行确定。</p>
<p>（2）发送方只重传那些没收到ACK的分组，为每个分组设置定时器。</p>
<p>（3）增加接收方窗口。</p>
<p><img src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014225416.jpg" alt="" / srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://gitee.com/baikaihua/tochang/raw/master/QQ%E6%88%AA%E5%9B%BE20211014225416.jpg" class="lozad post-image"></p>

  </div>
  <div>
    
      <div 
        class="post-note note-warning copyright" 
        style="margin-top: 42px">
        <p>
          <span style="font-weight: bold;">作者：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="/about">
            白开画 and 徐威
          </a>
        </p>
        <p>
          <span style="font-weight: bold;">文章链接：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="http://www.baikaihua.gitee.io/2021/10/14/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BC%A0%E8%BE%93%E5%B1%82%EF%BC%88%E4%B8%8A%EF%BC%89/index.html">
            http://www.baikaihua.gitee.io/2021/10/14/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BC%A0%E8%BE%93%E5%B1%82%EF%BC%88%E4%B8%8A%EF%BC%89/index.html
          </a>
        </p>
        <p><span style="font-weight: bold;">版权声明：</span>本博客所有文章除特别声明外，均采用<a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA 4.0 协议</a>。转载请注明出处！</p>
      </div>
    
  </div>
</article>
<div class="nav">
  
    <div class="nav-item-prev">
      <a 
        href="/2021/10/16/PHP%E8%BF%90%E7%AE%97%E7%AC%A6(1)/index.html" 
        class="nav-link">
        <i class="iconfont icon-left nav-prev-icon"></i>
        <div>
          <div class="nav-label">上一篇</div>
          
            <div class="nav-title">PHP运算符（1） </div>
          
        </div>
      </a>
    </div>
  
  
    <div class="nav-item-next">
      <a 
        href="/2021/10/10/%E8%B7%AF%E7%94%B1%E4%B8%8E%E4%BA%A4%E6%8D%A2%E6%8A%80%E6%9C%AF%EF%BC%881%EF%BC%89_%E4%BA%A4%E6%8D%A2%E7%BD%91%E7%BB%9C/index.html" 
        class="nav-link">
        <div>
          <div class="nav-label">下一篇</div>
          
            <div class="nav-title">路由与交换技术（1）_交换网络 </div>
          
        </div>
        <i class="iconfont icon-right nav-next-icon"></i>
      </a>
    </div>
  
</div>

  <div 
    class="card card-content comment-card" 
    style="margin-top: 16px;">
    <div class="comment-card-title">评论</div>
    
  <div id="vcomments"></div>
  
  <script>
    loadScript("//unpkg.com/valine/dist/Valine.min.js");
    var oldLoadVa = window.onload;
    window.onload = function () {
      oldLoadVa && oldLoadVa();
      new Valine({
        el: '#vcomments',
        appId: 'C2ey5RzCeMGvikIpezIqS1fW-gzGzoHsz',
        appKey: 'yNj1HPpcuT4nFzgDG1hfxiwX',
        placeholder: 'Just go go',
        path: window.location.pathname,
        avatar: 'mp',
        meta: ["nick","mail","link"],
        pageSize: '10',
        lang: '',
        visitor: 'false',
        highlight: true,
        recordIP: false,
        
        
        
        enableQQ: 'false',
        requiredFields: [],
      });
    };
  </script>

  </div>

<div 
  class="card card-content toc-card" 
  id="mobiletoc">
  <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BC%A0%E8%BE%93%E5%B1%82%E4%B8%8A"><span class="toc-number">1.</span> <span class="toc-text"> 计算机网络传输层（上）</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BC%A0%E8%BE%93%E5%B1%82%E6%A6%82%E8%BF%B0"><span class="toc-number">1.1.</span> <span class="toc-text"> 传输层概述</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8%E5%92%8C%E5%A4%9A%E8%B7%AF%E5%88%86%E7%94%A8"><span class="toc-number">1.2.</span> <span class="toc-text"> 多路复用和多路分用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%A0%E8%BF%9E%E6%8E%A5%E4%BC%A0%E8%BE%93%E5%8D%8F%E8%AE%AEudp"><span class="toc-number">1.3.</span> <span class="toc-text"> 无连接传输协议UDP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%AF%E9%9D%A0%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86"><span class="toc-number">1.4.</span> <span class="toc-text"> 可靠数据传输的基本原理</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%AF%E9%9D%A0%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E6%A6%82%E8%BF%B0"><span class="toc-number">1.4.1.</span> <span class="toc-text"> 可靠数据传输概述</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-10"><span class="toc-number">1.4.2.</span> <span class="toc-text"> rdt 1.0</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-20"><span class="toc-number">1.4.3.</span> <span class="toc-text"> rdt 2.0</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-21%E5%92%8C22"><span class="toc-number">1.4.4.</span> <span class="toc-text"> rdt 2.1和2.2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-30"><span class="toc-number">1.4.5.</span> <span class="toc-text"> rdt 3.0</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%81%E6%B0%B4%E7%BA%BF%E6%9C%BA%E5%88%B6%E4%B8%8E%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.</span> <span class="toc-text"> 流水线机制与滑动窗口协议</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%81%E6%B0%B4%E7%BA%BF%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.1.</span> <span class="toc-text"> 流水线协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E5%8D%8F%E8%AE%AEgbnsr"><span class="toc-number">1.5.2.</span> <span class="toc-text"> 滑动窗口协议（GBN,SR）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#gnb%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.3.</span> <span class="toc-text"> GNB协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#srselective-repeat%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.4.</span> <span class="toc-text"> SR（Selective Repeat）协议</span></a></li></ol></li></ol></li></ol>
</div></main>
            <aside class="left-column">
              
              <div class="card card-author">
                
  <img 
    src="https://gitee.com/baikaihua/tochang/raw/master/src=http___b-ssl.duitang.com_uploads_item_201607_07_20160707163006_EnLeG.jpeg&refer=http___b-ssl.duitang.jpg" 
    class="author-img" 
    alt="author avatar">

<p class="author-name">白开画 and 徐威</p>
<p class="author-description">欢迎！</p>
<div class="author-message">
  <a 
    class="author-posts-count" 
    href="/archives">
    <span>33</span>
    <span>文章</span>
  </a>
  <a 
    class="author-categories-count" 
    href="/categories">
    <span>11</span>
    <span>分类</span>
  </a>
  <a 
    class="author-tags-count" 
    href="/tags">
    <span>37</span>
    <span>标签</span>
  </a>
</div>

              </div>
               <div class="sticky-tablet">
  
  
    <article class="display-when-two-columns spacer">
      <div class="card card-content toc-card">
        <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BC%A0%E8%BE%93%E5%B1%82%E4%B8%8A"><span class="toc-number">1.</span> <span class="toc-text"> 计算机网络传输层（上）</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BC%A0%E8%BE%93%E5%B1%82%E6%A6%82%E8%BF%B0"><span class="toc-number">1.1.</span> <span class="toc-text"> 传输层概述</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8%E5%92%8C%E5%A4%9A%E8%B7%AF%E5%88%86%E7%94%A8"><span class="toc-number">1.2.</span> <span class="toc-text"> 多路复用和多路分用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%A0%E8%BF%9E%E6%8E%A5%E4%BC%A0%E8%BE%93%E5%8D%8F%E8%AE%AEudp"><span class="toc-number">1.3.</span> <span class="toc-text"> 无连接传输协议UDP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%AF%E9%9D%A0%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86"><span class="toc-number">1.4.</span> <span class="toc-text"> 可靠数据传输的基本原理</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%AF%E9%9D%A0%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E6%A6%82%E8%BF%B0"><span class="toc-number">1.4.1.</span> <span class="toc-text"> 可靠数据传输概述</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-10"><span class="toc-number">1.4.2.</span> <span class="toc-text"> rdt 1.0</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-20"><span class="toc-number">1.4.3.</span> <span class="toc-text"> rdt 2.0</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-21%E5%92%8C22"><span class="toc-number">1.4.4.</span> <span class="toc-text"> rdt 2.1和2.2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-30"><span class="toc-number">1.4.5.</span> <span class="toc-text"> rdt 3.0</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%81%E6%B0%B4%E7%BA%BF%E6%9C%BA%E5%88%B6%E4%B8%8E%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.</span> <span class="toc-text"> 流水线机制与滑动窗口协议</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%81%E6%B0%B4%E7%BA%BF%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.1.</span> <span class="toc-text"> 流水线协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E5%8D%8F%E8%AE%AEgbnsr"><span class="toc-number">1.5.2.</span> <span class="toc-text"> 滑动窗口协议（GBN,SR）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#gnb%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.3.</span> <span class="toc-text"> GNB协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#srselective-repeat%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.4.</span> <span class="toc-text"> SR（Selective Repeat）协议</span></a></li></ol></li></ol></li></ol>
      </div>
    </article>
  
  
  <article class="card card-content categories-widget">
    <div class="categories-card">
  <div class="categories-header">
    <i 
      class="iconfont icon-fenlei" 
      style="padding-right: 2px;">
    </i>分类
  </div>
  <div class="categories-list">
    
      <a href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/">
        <div class="categories-list-item">
          计算机网络
          <span class="categories-list-item-badge">5</span>
        </div>
      </a>
    
      <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/">
        <div class="categories-list-item">
          数据库
          <span class="categories-list-item-badge">3</span>
        </div>
      </a>
    
      <a href="/categories/PHP/">
        <div class="categories-list-item">
          PHP
          <span class="categories-list-item-badge">14</span>
        </div>
      </a>
    
      <a href="/categories/Windows%E7%B3%BB%E7%BB%9F/">
        <div class="categories-list-item">
          Windows系统
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/Python/">
        <div class="categories-list-item">
          Python
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/Linux/">
        <div class="categories-list-item">
          Linux
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/">
        <div class="categories-list-item">
          数据结构与算法
          <span class="categories-list-item-badge">2</span>
        </div>
      </a>
    
      <a href="/categories/%E7%BD%91%E7%BB%9C/">
        <div class="categories-list-item">
          网络
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/">
        <div class="categories-list-item">
          路由交换
          <span class="categories-list-item-badge">3</span>
        </div>
      </a>
    
      <a href="/categories/%E8%BD%AC%E8%BD%BD/">
        <div class="categories-list-item">
          转载
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/python/">
        <div class="categories-list-item">
          python
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
  </div>
</div>
  </article>
  
  <article class="card card-content tags-widget">
    <div class="tags-card">
  <div class="tags-header">
    <i 
      class="iconfont icon-biaoqian" 
      style="padding-right: 2px;">
    </i>热门标签
  </div>
  <div class="tags-list">
    
      <a 
        href="/tags/%E7%99%BD%E5%BC%80%E7%94%BB/" 
        title="白开画">
        <div class="tags-list-item">白开画</div>
      </a>
    
      <a 
        href="/tags/%E5%BE%90%E5%A8%81/" 
        title="徐威">
        <div class="tags-list-item">徐威</div>
      </a>
    
      <a 
        href="/tags/PHP/" 
        title="PHP">
        <div class="tags-list-item">PHP</div>
      </a>
    
      <a 
        href="/tags/web%E8%84%9A%E6%9C%AC/" 
        title="web脚本">
        <div class="tags-list-item">web脚本</div>
      </a>
    
      <a 
        href="/tags/%E7%BD%91%E7%BB%9C/" 
        title="网络">
        <div class="tags-list-item">网络</div>
      </a>
    
      <a 
        href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/" 
        title="计算机网络">
        <div class="tags-list-item">计算机网络</div>
      </a>
    
      <a 
        href="/tags/%E5%8D%8E%E4%B8%BA/" 
        title="华为">
        <div class="tags-list-item">华为</div>
      </a>
    
      <a 
        href="/tags/%E5%8D%8E%E4%B8%BA%E8%AE%A4%E8%AF%81/" 
        title="华为认证">
        <div class="tags-list-item">华为认证</div>
      </a>
    
      <a 
        href="/tags/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/" 
        title="路由交换">
        <div class="tags-list-item">路由交换</div>
      </a>
    
      <a 
        href="/tags/GVRP/" 
        title="GVRP">
        <div class="tags-list-item">GVRP</div>
      </a>
    
      <a 
        href="/tags/VLAN/" 
        title="VLAN">
        <div class="tags-list-item">VLAN</div>
      </a>
    
      <a 
        href="/tags/%E5%9F%BA%E7%A1%80/" 
        title="基础">
        <div class="tags-list-item">基础</div>
      </a>
    
      <a 
        href="/tags/ip/" 
        title="ip">
        <div class="tags-list-item">ip</div>
      </a>
    
      <a 
        href="/tags/%E5%A4%A7%E6%95%B0/" 
        title="大数">
        <div class="tags-list-item">大数</div>
      </a>
    
      <a 
        href="/tags/python/" 
        title="python">
        <div class="tags-list-item">python</div>
      </a>
    
      <a 
        href="/tags/%E5%91%BD%E4%BB%A4%E6%8F%90%E7%A4%BA%E7%AC%A6/" 
        title="命令提示符">
        <div class="tags-list-item">命令提示符</div>
      </a>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
            <aside class="right-column">
              <div class="sticky-widescreen">
  
  
    <article class="card card-content toc-card">
      <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BC%A0%E8%BE%93%E5%B1%82%E4%B8%8A"><span class="toc-number">1.</span> <span class="toc-text"> 计算机网络传输层（上）</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BC%A0%E8%BE%93%E5%B1%82%E6%A6%82%E8%BF%B0"><span class="toc-number">1.1.</span> <span class="toc-text"> 传输层概述</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8%E5%92%8C%E5%A4%9A%E8%B7%AF%E5%88%86%E7%94%A8"><span class="toc-number">1.2.</span> <span class="toc-text"> 多路复用和多路分用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%A0%E8%BF%9E%E6%8E%A5%E4%BC%A0%E8%BE%93%E5%8D%8F%E8%AE%AEudp"><span class="toc-number">1.3.</span> <span class="toc-text"> 无连接传输协议UDP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%AF%E9%9D%A0%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86"><span class="toc-number">1.4.</span> <span class="toc-text"> 可靠数据传输的基本原理</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%AF%E9%9D%A0%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E6%A6%82%E8%BF%B0"><span class="toc-number">1.4.1.</span> <span class="toc-text"> 可靠数据传输概述</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-10"><span class="toc-number">1.4.2.</span> <span class="toc-text"> rdt 1.0</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-20"><span class="toc-number">1.4.3.</span> <span class="toc-text"> rdt 2.0</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-21%E5%92%8C22"><span class="toc-number">1.4.4.</span> <span class="toc-text"> rdt 2.1和2.2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rdt-30"><span class="toc-number">1.4.5.</span> <span class="toc-text"> rdt 3.0</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%81%E6%B0%B4%E7%BA%BF%E6%9C%BA%E5%88%B6%E4%B8%8E%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.</span> <span class="toc-text"> 流水线机制与滑动窗口协议</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%81%E6%B0%B4%E7%BA%BF%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.1.</span> <span class="toc-text"> 流水线协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E5%8D%8F%E8%AE%AEgbnsr"><span class="toc-number">1.5.2.</span> <span class="toc-text"> 滑动窗口协议（GBN,SR）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#gnb%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.3.</span> <span class="toc-text"> GNB协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#srselective-repeat%E5%8D%8F%E8%AE%AE"><span class="toc-number">1.5.4.</span> <span class="toc-text"> SR（Selective Repeat）协议</span></a></li></ol></li></ol></li></ol>
    </article>
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    <i 
      class="iconfont icon-wenzhang_huaban" 
      style="padding-right: 2px;">
    </i>最近文章
  </div>
  <div class="recent-posts-list">
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-13</div>
        <a href="/2021/12/13/python%E7%88%AC%E5%8F%96%E6%B7%98%E5%AE%9D%E5%95%86%E5%93%81/index.html"><div class="recent-posts-item-content">python爬取淘宝商品</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-13</div>
        <a href="/2021/12/13/PHP%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C/index.html"><div class="recent-posts-item-content">PHP字符串常用操作</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-11-29</div>
        <a href="/2021/11/29/PHP%E8%AE%A4%E8%AF%86%E5%AD%97%E7%AC%A6%E4%B8%B2/index.html"><div class="recent-posts-item-content">PHP认识字符串</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-11-21</div>
        <a href="/2021/11/21/PHP%E5%87%BD%E6%95%B0%E7%9A%84%E5%BA%94%E7%94%A8/index.html"><div class="recent-posts-item-content">PHP函数的应用</div></a>
      </div>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
          </div>
        </div>
      </div>
    </div>
     
    <footer class="footer">
  <div class="footer-container">
    <div>
      <div class="footer-dsc">
        <span>
          Copyright ©
          
            2021 -
          
          2021
        </span>
        &nbsp;
        <a 
          href="/" 
          class="footer-link">
          程序小站
        </a>
      </div>
    </div>

    
      <div class="footer-dsc">
        
          Powered by
          <a 
            href="https://hexo.io/" 
            class="footer-link" 
            target="_blank" 
            rel="nofollow noopener noreferrer">
            &nbsp;Hexo
          </a>
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          Theme -
          <a 
            href="https://github.com/theme-kaze" 
            class="footer-link" 
            target="_blank"
            rel="nofollow noopener noreferrer">
            &nbsp;Kaze
          </a>
        
      </div>
    
    
    
    
      <div class="footer-dsc">
        
          本站总访问量<span id="busuanzi_value_site_pv"></span>次
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          本站总访客数<span id="busuanzi_value_site_uv"></span>次
        
      </div>
      
    
</footer> 
    
  <a 
    role="button" 
    id="scrollbutton" 
    class="basebutton" 
    aria-label="回到顶部">
    <i class="iconfont icon-arrowleft button-icon"></i>
  </a>

<a 
  role="button" 
  id="menubutton" 
  class="basebutton">
  <i class="iconfont icon-menu button-icon"></i>
</a>
<a 
  role="button" 
  id="popbutton" 
  class="basebutton" 
  aria-label="控制中心">
  <i class="iconfont icon-expand button-icon"></i>
</a>
<a 
  role="button" 
  id="darkbutton" 
  class="basebutton darkwidget" 
  aria-label="夜色模式">
  <i class="iconfont icon-weather button-icon"></i>
</a>
<a 
  role="button" 
  id="searchbutton" 
  class="basebutton searchwidget" 
  aria-label="搜索">
  <i class="iconfont icon-search button-icon"></i>
</a> 
     
     
      

  
  
    
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css">

  
 
     
     
      <script>
  var addImgLayout = function () {
    var img = document.querySelectorAll('.post-content img')
    var i
    for (i = 0; i < img.length; i++) {
      var wrapper = document.createElement('a')
      wrapper.setAttribute('href', img[i].getAttribute('data-src'))
      wrapper.setAttribute('aria-label', 'illustration')
      wrapper.style.cssText =
        'width: 100%; display: flex; justify-content: center;'
      if (img[i].alt) wrapper.dataset.caption = img[i].alt
      wrapper.dataset.nolink = true
      img[i].before(wrapper)
      wrapper.append(img[i])
      var divWrap = document.createElement('div')
      divWrap.classList.add('gallery')
      wrapper.before(divWrap)
      divWrap.append(wrapper)
    }
    baguetteBox.run('.gallery')
  }
</script>
<script>
  loadScript(
    "/js/lib/lightbox/baguetteBox.min.js",
    addImgLayout
  )
</script>
 
     
     
    <script src="/js/main.js"></script> 
    
      <script> 
        loadScript('/js/lib/busuanzi.min.js') 
      </script>
     
    
      <script>
        var addLazyload = function () {
          var observer = lozad('.lozad', {
            load: function (el) {
              el.srcset = el.getAttribute('data-src')
            },
            loaded: function (el) {
              el.classList.add('loaded')
            },
          })
          observer.observe()
        }
      </script>
      <script>
        loadScript('/js/lib/lozad.min.js', addLazyload)
      </script>
     
    
    
      <script>
        setTimeout(() => {localSearch("search.json")}, 0)
      </script>
    
  </body>
</html>
